﻿; (function (window, undefined, $) {
    var submiting = false;
    $('#frmEdit').validator({
        rules: {

        },
        fields: {
            '#FundName': 'required',
            '#FundContent': 'required',
            '#RunPeople': 'required',
            '#CreateTime': 'required',
            '#Remark': 'required'
        },
        valid: function (form) {
            if (submiting) {
                return;
            }
            submiting = true;
            FormSubmit(form, function(res) {
                if (res.Status > 0) {
                    alert(res.Message);
                    window.location.href = "/Admin/Fund/FundAuditList";
                } else {
                    alert(res.Message);
                }
                submiting = false;
            });
        }
    });

    $("#btnReturn").click(function (e) {
        window.location.href = "/Admin/Fund/FundAuditList";
    });
    
    //审核通过
    $("#btnAudit").click(function (e) {
        $.post(options.AuditUrl, { id: $('#hideId').val(), audituser: $('#AuditUser').val(), status: 0, datetime: $('#AuditTime').val(), auditremark: $('#AuditExplain').val() },
          function (res) {
              if (res > 0) {
                  alert("操作成功！");
                  window.location.href = "/Admin/Fund/FundAuditList";
              }
              else {
                  alert("操作失败！");
              }
          },
          "json"
    );
    });

    //退回
    $("#btnback").click(function (e) {
        $.post(options.AuditUrl, { id: $('#hideId').val(), audituser: $('#AuditUser').val(), status: 2, datetime: $('#AuditTime').val(), auditremark: $('#AuditExplain').val() },
          function (res) {
              if (res > 0) {
                  alert("操作成功！");
                  window.location.href = "/Admin/Fund/FundAuditList";
              }
              else {
                  alert("操作失败！");
              }
          },
          "json"
    );
    });
})(window, undefined, jQuery);